package com.whale.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.whale.constants.MenuGroupConstants;

@Controller
@RequestMapping(value = "/business")
public class BusinessController extends AbstractController {

	@RequestMapping(method = RequestMethod.GET)
	public String getListBusinessGroup(Model model) {
		populateNavigation(model, "/business", MenuGroupConstants.USER_MENU_GROUP_ID);
		return "business/listBusinessGroup";
	}

	@RequestMapping(value = "{businessGroupId}", method = RequestMethod.GET)
	public String getBusinessGroup(@PathVariable String businessGroupId,
			Model model) {
		populateSubNavigation(model, "/business", businessGroupId, MenuGroupConstants.USER_MENU_GROUP_ID);
		return "business/businessGroup";
	}

	@RequestMapping(value = "{businessGroupId}/{businessId}", method = RequestMethod.GET)
	public String getBusiness(@PathVariable String businessGroupId,
			@PathVariable String businessId, Model model) {
		model.addAttribute("newsgroupId", businessGroupId);
		model.addAttribute("businessId", businessId);
		return "business/businessView";
	}
}
